package com.shanzmoo.db.module.member.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.shanzmoo.db.module.member.domain.query.CMemberCouponQuery;
import com.shanzmoo.db.module.member.domain.vo.CMemberCouponVO;
import com.shanzmoo.db.module.member.entity.MemberCouponEntity;
import com.shanzmoo.db.module.member.mapper.MemberCouponMapper;
import com.shanzmoo.db.module.member.service.IMemberCouponService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 会员优惠券 服务实现类
 * </p>
 *
 * @author wangyudi
 * @since 2021-03-22
 */
@Service
public class MemberCouponServiceImpl extends ServiceImpl<MemberCouponMapper, MemberCouponEntity> implements IMemberCouponService {

    @Override
    public IPage<CMemberCouponVO> queryCByRequest(CMemberCouponQuery query) {
        return baseMapper.queryCByRequest(query.page(),query);
    }

    @Override
    public List<MemberCouponEntity> listByMemberMerchantId(Integer id) {
        return list(
                new LambdaQueryWrapper<MemberCouponEntity>()
                        .eq(MemberCouponEntity::getMemberId,id)
                        .eq(MemberCouponEntity::getDeleted,false)
                .eq(MemberCouponEntity::getStatus,1)
        );
    }
}
